package com.gxwy.shenzhou;


public class KaihuRequest implements StringHandler{
	private HeaderRequest header=new HeaderRequest(false);
	private String zhdh;
	public static final int ZHDH_LEN=32;
	public static final int ZHDH_FLAG=2;
	private String weizhi1;
	public static final int WEIZHI1_LEN=1;
	public static final int WEIZHI1_FLAG=2;
	private String pzdh;
	public static final int PZDH_LEN=9;
	public static final int PZDH_FLAG=2;
	private String mm;
	public static final int MM_LEN=16;
	public static final int MM_FLAG=2;
	private String khmc;
	public static final int KHMC_LEN=50;
	public static final int KHMC_FLAG=2;
	private String yddh;
	public static final int YDDH_LEN=15;
	public static final int YDDH_FLAG=2;
	private String weizhi2;
	public static final int WEIZHI2_LEN=50;
	public static final int WEIZHI2_FLAG=2;
	private String xmdh;
	public static final int XMDH_LEN=1;
	public static final int XMDH_FLAG=2;
	private String czgn;
	public static final int CZGN_LEN=1;
	public static final int CZGN_FLAG=2;
	private String zz_ed;
	public static final int ZZ_ED_LEN=15;
	public static final int ZZ_ED_FLAG=2;
	private String flbz0;
	public static final int FLBZ0_LEN=1;
	public static final int FLBZ0_FLAG=2;
	private String flbz1;
	public static final int FLBZ1_LEN=1;
	public static final int FLBZ1_FLAG=2;
	private String flbz2;
	public static final int FLBZ2_LEN=1;
	public static final int FLBZ2_FLAG=2;
	private String flbz3;
	public static final int FLBZ3_LEN=1;
	public static final int FLBZ3_FLAG=2;
	private String flbz4;
	public static final int FLBZ4_LEN=1;
	public static final int FLBZ4_FLAG=2;
	private String flbz5;
	public static final int FLBZ5_LEN=1;
	public static final int FLBZ5_FLAG=2;
	private String flbz6;
	public static final int FLBZ6_LEN=1;
	public static final int FLBZ6_FLAG=2;
	private String flbz7;
	public static final int FLBZ7_LEN=1;
	public static final int FLBZ7_FLAG=2;
	private String zjlx;
	public static final int ZJLX_LEN=1;
	public static final int ZJLX_FLAG=2;
	private String zjhm;
	public static final int ZJHM_LEN=20;
	public static final int ZJHM_FLAG=2;
	private String dz;
	public static final int DZ_LEN=80;
	public static final int DZ_FLAG=2;
	private String xb;
	public static final int XB_LEN=1;
	public static final int XB_FLAG=2;
	private String weizhi3;
	public static final int WEIZHI3_LEN=12;
	public static final int WEIZHI3_FLAG=2;
	public static final int TOTAL_LEN=ZHDH_LEN+WEIZHI1_LEN+PZDH_LEN+MM_LEN+KHMC_LEN+YDDH_LEN+
			WEIZHI2_LEN+XMDH_LEN+CZGN_LEN+ZZ_ED_LEN+FLBZ0_LEN+FLBZ1_LEN+FLBZ2_LEN+FLBZ3_LEN+FLBZ4_LEN+
			FLBZ5_LEN+FLBZ6_LEN+FLBZ7_LEN+ZJLX_LEN+ZJHM_LEN+DZ_LEN+XB_LEN+WEIZHI3_LEN;
	private int reallen=0;
	public HeaderRequest getHeader() {
		return header;
	}
	public void setHeader(HeaderRequest header) {
		this.header = header;
	}
	public String getZhdh() {
		return zhdh;
	}
	public void setZhdh(String zhdh) throws Exception{
		if(zhdh==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zhdh.getBytes("gbk").length<ZHDH_LEN){
			this.zhdh=Supply.supply(zhdh, ZHDH_FLAG, ZHDH_LEN);
		}else if(zhdh.getBytes("gbk").length>ZHDH_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.zhdh = zhdh;			
		}
	}
	public String getWeizhi1() {
		return weizhi1;
	}
	public void setWeizhi1(String weizhi1) throws Exception {
		if(weizhi1==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(weizhi1.getBytes("gbk").length<WEIZHI1_LEN){
			this.weizhi1=Supply.supply(weizhi1, WEIZHI1_FLAG, WEIZHI1_LEN);
		}else if(weizhi1.getBytes("gbk").length>WEIZHI1_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.weizhi1 = weizhi1;			
		}
	}
	public String getPzdh() {
		return pzdh;
	}
	public void setPzdh(String pzdh) throws Exception {
		if(pzdh==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(pzdh.getBytes("gbk").length<PZDH_LEN){
			this.pzdh=Supply.supply(pzdh, PZDH_FLAG, PZDH_LEN);
		}else if(pzdh.getBytes("gbk").length>PZDH_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.pzdh = pzdh;			
		}
	}
	public String getMm() {
		return mm;
	}
	public void setMm(String mm) throws Exception {
		if(mm==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(mm.getBytes("gbk").length<MM_LEN){
			this.mm=Supply.supply(mm, MM_FLAG, MM_LEN);
		}else if(mm.getBytes("gbk").length>MM_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.mm = mm;			
		}
	}
	public String getKhmc() {
		return khmc;
	}
	public void setKhmc(String khmc) throws Exception {
		if(khmc==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(khmc.getBytes("gbk").length<KHMC_LEN){
			this.khmc=Supply.supply(khmc, KHMC_FLAG, KHMC_LEN);
		}else if(khmc.getBytes("gbk").length>KHMC_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.khmc = khmc;			
		}
	}
	public String getYddh() {
		return yddh;
	}
	public void setYddh(String yddh) throws Exception {
		if(yddh==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(yddh.getBytes("gbk").length<YDDH_LEN){
			this.yddh=Supply.supply(yddh, YDDH_FLAG, YDDH_LEN);
		}else if(yddh.getBytes("gbk").length>YDDH_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.yddh = yddh;			
		}
	}
	public String getWeizhi2() {
		return weizhi2;
	}
	public void setWeizhi2(String weizhi2) throws Exception {
		if(weizhi2==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(weizhi2.getBytes("gbk").length<WEIZHI2_LEN){
			this.weizhi2=Supply.supply(weizhi2, WEIZHI2_FLAG, WEIZHI2_LEN);
		}else if(weizhi2.getBytes("gbk").length>WEIZHI2_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.weizhi2 = weizhi2;			
		}
	}
	public String getXmdh() {
		return xmdh;
	}
	public void setXmdh(String xmdh) throws Exception {
		if(xmdh==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(xmdh.getBytes("gbk").length<XMDH_LEN){
			this.xmdh=Supply.supply(xmdh, XMDH_FLAG, XMDH_LEN);
		}else if(xmdh.getBytes("gbk").length>XMDH_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.xmdh = xmdh;			
		}
	}
	public String getCzgn() {
		return czgn;
	}
	public void setCzgn(String czgn) throws Exception {
		if(czgn==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(czgn.getBytes("gbk").length<CZGN_LEN){
			this.czgn=Supply.supply(czgn, CZGN_FLAG, CZGN_LEN);
		}else if(czgn.getBytes("gbk").length>CZGN_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.czgn = czgn;			
		}
	}
	public String getZz_ed() {
		return zz_ed;
	}
	public void setZz_ed(String zz_ed) throws Exception {
		if(zz_ed==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zz_ed.getBytes("gbk").length<ZZ_ED_LEN){
			this.zz_ed=Supply.supply(zz_ed, ZZ_ED_FLAG, ZZ_ED_LEN);
		}else if(zz_ed.getBytes("gbk").length>ZZ_ED_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.zz_ed = zz_ed;			
		}
	}
	public String getFlbz0() {
		return flbz0;
	}
	public void setFlbz0(String flbz0) throws Exception {
		if(flbz0==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz0.getBytes("gbk").length<FLBZ0_LEN){
			this.flbz0=Supply.supply(flbz0, FLBZ0_FLAG, FLBZ0_LEN);
		}else if(flbz0.getBytes("gbk").length>FLBZ0_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz0 = flbz0;			
		}
	}
	public String getFlbz1() {
		return flbz1;
	}
	public void setFlbz1(String flbz1) throws Exception {
		if(flbz1==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz1.getBytes("gbk").length<FLBZ1_LEN){
			this.flbz1=Supply.supply(flbz1, FLBZ1_FLAG, FLBZ1_LEN);
		}else if(flbz1.getBytes("gbk").length>FLBZ1_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz1 = flbz1;			
		}
	}
	public String getFlbz2() {
		return flbz2;
	}
	public void setFlbz2(String flbz2) throws Exception {
		if(flbz2==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz2.getBytes("gbk").length<FLBZ2_LEN){
			this.flbz2=Supply.supply(flbz2, FLBZ2_FLAG, FLBZ2_LEN);
		}else if(flbz2.getBytes("gbk").length>FLBZ2_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz2 = flbz2;			
		}
	}
	public String getFlbz3() {
		return flbz3;
	}
	public void setFlbz3(String flbz3) throws Exception {
		if(flbz3==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz3.getBytes("gbk").length<FLBZ3_LEN){
			this.flbz3=Supply.supply(flbz3, FLBZ3_FLAG, FLBZ3_LEN);
		}else if(flbz3.getBytes("gbk").length>FLBZ3_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz3 = flbz3;			
		}
	}
	public String getFlbz4() {
		return flbz4;
	}
	public void setFlbz4(String flbz4) throws Exception {
		if(flbz4==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz4.getBytes("gbk").length<FLBZ4_LEN){
			this.flbz4=Supply.supply(flbz4, FLBZ4_FLAG, FLBZ4_LEN);
		}else if(flbz4.getBytes("gbk").length>FLBZ4_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz4 = flbz4;			
		}
	}
	public String getFlbz5() {
		return flbz5;
	}
	public void setFlbz5(String flbz5) throws Exception {
		if(flbz5==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz5.getBytes("gbk").length<FLBZ5_LEN){
			this.flbz5=Supply.supply(flbz5, FLBZ5_FLAG, FLBZ5_LEN);
		}else if(flbz5.getBytes("gbk").length>FLBZ5_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz5 = flbz5;			
		}
	}
	public String getFlbz6() {
		return flbz6;
	}
	public void setFlbz6(String flbz6) throws Exception {
		if(flbz6==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz6.getBytes("gbk").length<FLBZ6_LEN){
			this.flbz6=Supply.supply(flbz6, FLBZ6_FLAG, FLBZ6_LEN);
		}else if(flbz6.getBytes("gbk").length>FLBZ6_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz6 = flbz6;			
		}
	}
	public String getFlbz7() {
		return flbz7;
	}
	public void setFlbz7(String flbz7) throws Exception {
		if(flbz7==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(flbz7.getBytes("gbk").length<FLBZ7_LEN){
			this.flbz7=Supply.supply(flbz7, FLBZ7_FLAG, FLBZ7_LEN);
		}else if(flbz7.getBytes("gbk").length>FLBZ7_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.flbz7 = flbz7;			
		}
	}
	public String getZjlx() {
		return zjlx;
	}
	public void setZjlx(String zjlx) throws Exception {
		if(zjlx==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zjlx.getBytes("gbk").length<ZJLX_LEN){
			this.zjlx=Supply.supply(zjlx, ZJLX_FLAG, ZJLX_LEN);
		}else if(zjlx.getBytes("gbk").length>ZJLX_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.zjlx = zjlx;			
		}
	}
	public String getZjhm() {
		return zjhm;
	}
	public void setZjhm(String zjhm) throws Exception {
		if(zjhm==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zjhm.getBytes("gbk").length<ZJHM_LEN){
			this.zjhm=Supply.supply(zjhm, ZJHM_FLAG, ZJHM_LEN);
		}else if(zjhm.getBytes("gbk").length>ZJHM_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.zjhm = zjhm;			
		}
	}
	public String getDz() {
		return dz;
	}
	public void setDz(String dz) throws Exception {
		if(dz==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(dz.getBytes("gbk").length<DZ_LEN){
			this.dz=Supply.supply(dz, DZ_FLAG, DZ_LEN);
		}else if(dz.getBytes("gbk").length>DZ_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.dz = dz;			
		}
	}
	public String getXb() {
		return xb;
	}
	public void setXb(String xb) throws Exception {
		if(xb==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(xb.getBytes("gbk").length<XB_LEN){
			this.xb=Supply.supply(xb, XB_FLAG, XB_LEN);
		}else if(xb.getBytes("gbk").length>XB_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.xb = xb;			
		}
	}
	public String getWeizhi3() {
		return weizhi3;
	}
	public void setWeizhi3(String weizhi3) throws Exception {
		if(weizhi3==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(weizhi3.getBytes("gbk").length<WEIZHI3_LEN){
			this.weizhi3=Supply.supply(weizhi3, WEIZHI3_FLAG, WEIZHI3_LEN);
		}else if(weizhi3.getBytes("gbk").length>WEIZHI3_LEN){
			 Exception e=new Exception("Too long");
			 throw e;
		}else{
			this.weizhi3 = weizhi3;			
		}
	}
	

	@Override
	public String toString() {
		return "KaihuRequest [header=" + header.toString() + ", zhdh=" + zhdh
				+ ", weizhi1=" + weizhi1 + ", pzdh=" + pzdh + ", mm=" + mm
				+ ", khmc=" + khmc + ", yddh=" + yddh + ", weizhi2=" + weizhi2
				+ ", xmdh=" + xmdh + ", czgn=" + czgn + ", zz_ed=" + zz_ed
				+ ", flbz0=" + flbz0 + ", flbz1=" + flbz1 + ", flbz2=" + flbz2
				+ ", flbz3=" + flbz3 + ", flbz4=" + flbz4 + ", flbz5=" + flbz5
				+ ", flbz6=" + flbz6 + ", flbz7=" + flbz7 + ", zjlx=" + zjlx
				+ ", zjhm=" + zjhm + ", dz=" + dz + ", xb=" + xb + ", weizhi3="
				+ weizhi3 + ", reallen=" + reallen + "]";
	}
	public String build() throws Exception{
		if(this.getHeader()==null){
			throw new Exception("Header is null");
		}
		if(this.getZhdh()==null){
			this.setZhdh("");
		}
		if(this.getWeizhi1()==null){
			this.setWeizhi1("");
		}
		if(this.getPzdh()==null){
			this.setPzdh("");
		}
		if(this.getMm()==null){
			this.setMm("");
		}
		if(this.getKhmc()==null){
			this.setKhmc("");
		}
		if(this.getYddh()==null){
			this.setYddh("");
		}
		if(this.getWeizhi2()==null){
			this.setWeizhi2("");
		}
		if(this.getXmdh()==null){
			this.setXmdh("");
		}
		if(this.getCzgn()==null){
			this.setCzgn("");
		}
		if(this.getZz_ed()==null){
			this.setZz_ed("");
		}
		if(this.getFlbz0()==null){
			this.setFlbz0("");
		}
		if(this.getFlbz1()==null){
			this.setFlbz1("");
		}
		if(this.getFlbz2()==null){
			this.setFlbz2("");
		}
		if(this.getFlbz3()==null){
			this.setFlbz3("");
		}
		if(this.getFlbz4()==null){
			this.setFlbz4("");
		}
		if(this.getFlbz5()==null){
			this.setFlbz5("");
		}
		if(this.getFlbz6()==null){
			this.setFlbz6("");
		}
		if(this.getFlbz7()==null){
			this.setFlbz7("");
		}
		if(this.getZjlx()==null){
			this.setZjlx("");
		}
		if(this.getZjhm()==null){
			this.setZjhm("");
		}
		if(this.getDz()==null){
			this.setDz("");
		}
		if(this.getXb()==null){
			this.setXb("");
		}
		if(this.getWeizhi3()==null){
			this.setWeizhi3("");
		}
		Integer totallen=header.TOTAL_LEN+TOTAL_LEN-HeaderRequest.LEN_LEN;
		this.getHeader().setLen(totallen.toString());
		return  this.getHeader().build()+this.getZhdh()+this.getWeizhi1()+this.getPzdh()+this.getMm()+this.getKhmc()+this.getYddh()+this.getWeizhi2()+this.getXmdh()+
				this.getCzgn()+this.getZz_ed()+this.getFlbz0()+this.getFlbz1()+this.getFlbz2()+
				this.getFlbz3()+this.getFlbz4()+this.getFlbz5()+this.getFlbz6()+this.getFlbz7()+this.getZjlx()+
				this.getZjhm()+this.getDz()+this.getXb()+this.getWeizhi3();
	}
	public void parse(String str) throws Exception{
		if(str==null){
			Exception e=new Exception("String is null");
			 throw e;
		}else if(str.getBytes("gbk").length<header.TOTAL_LEN+TOTAL_LEN){
			Exception e=new Exception("Invalid request");
			 throw e;
		}else{
			String headerLen=SplitString.splitString(str,reallen, reallen+header.TOTAL_LEN);
			reallen+=header.TOTAL_LEN;
			header.parse(headerLen);
		this.setZhdh(SplitString.splitString(str,reallen,reallen+ZHDH_LEN));
		reallen+=ZHDH_LEN;
		this.setWeizhi1(SplitString.splitString(str,reallen, reallen+WEIZHI1_LEN));
		reallen+=WEIZHI1_LEN;
		this.setPzdh(SplitString.splitString(str,reallen,reallen+PZDH_LEN));
		reallen+=PZDH_LEN;
		this.setMm(SplitString.splitString(str,reallen,reallen+MM_LEN));
		reallen+=MM_LEN;
		this.setKhmc(SplitString.splitString(str,reallen,reallen+KHMC_LEN));
		reallen+=KHMC_LEN;
		this.setYddh(SplitString.splitString(str,reallen,reallen+YDDH_LEN));
		reallen+=YDDH_LEN;
		this.setWeizhi2(SplitString.splitString(str,reallen, reallen+WEIZHI2_LEN));
		reallen+=WEIZHI2_LEN;
		this.setXmdh(SplitString.splitString(str,reallen,reallen+XMDH_LEN));
		reallen+=XMDH_LEN;
		this.setCzgn(SplitString.splitString(str,reallen, reallen+CZGN_LEN));
		reallen+=CZGN_LEN;
		this.setZz_ed(SplitString.splitString(str,reallen, reallen+ZZ_ED_LEN));
		reallen+=ZZ_ED_LEN;
		this.setFlbz0(SplitString.splitString(str,reallen, reallen+FLBZ0_LEN));
		reallen+=FLBZ0_LEN;
		this.setFlbz1(SplitString.splitString(str,reallen, reallen+FLBZ1_LEN));
		reallen+=FLBZ1_LEN;
		this.setFlbz2(SplitString.splitString(str,reallen, reallen+FLBZ2_LEN));
		reallen+=FLBZ2_LEN;
		this.setFlbz3(SplitString.splitString(str,reallen, reallen+FLBZ3_LEN));
		reallen+=FLBZ3_LEN;
		this.setFlbz4(SplitString.splitString(str,reallen, reallen+FLBZ4_LEN));
		reallen+=FLBZ4_LEN;
		this.setFlbz5(SplitString.splitString(str,reallen, reallen+FLBZ5_LEN));
		reallen+=FLBZ5_LEN;
		this.setFlbz6(SplitString.splitString(str,reallen, reallen+FLBZ6_LEN));
		reallen+=FLBZ6_LEN;
		this.setFlbz7(SplitString.splitString(str,reallen, reallen+FLBZ7_LEN));
		reallen+=FLBZ7_LEN;
		this.setZjlx(SplitString.splitString(str,reallen, reallen+ZJLX_LEN));
		reallen+=ZJLX_LEN;
		this.setZjhm(SplitString.splitString(str,reallen, reallen+ZJHM_LEN));
		reallen+=ZJHM_LEN;
		this.setDz(SplitString.splitString(str,reallen, reallen+DZ_LEN));
		reallen+=DZ_LEN;
		this.setXb(SplitString.splitString(str,reallen, reallen+XB_LEN));
		reallen+=XB_LEN;
		this.setWeizhi3(SplitString.splitString(str,reallen, reallen+WEIZHI3_LEN));
		reallen+=WEIZHI3_LEN;
		}
	} 
}
